//
//  CellForNBAFlash.m
//  MY Project For Sport
//
//  Created by dllo on 16/1/27.
//  Copyright © 2016年 dilo. All rights reserved.
//

#import "CellForNBAFlash.h"
#import "ModelForNBA.h"
#import <SDWebImage/UIImageView+WebCache.h>
#import <DKNightVersion.h>
#import "UIColor+Wonderful.h"
#define WEIGHTT [UIScreen mainScreen].bounds.size.width / 375
#define HEIGHTT [UIScreen mainScreen].bounds.size.height / 667


@interface CellForNBAFlash ()

@property (nonatomic, retain) UILabel *labelForTitle;
@property (nonatomic, retain) UIImageView *imageViewForFlash;
@property (nonatomic, retain) UILabel *labelForFootTitle;
@property (nonatomic, retain) UIView *view;
@end

@implementation CellForNBAFlash

- (void)dealloc {
    
    [_labelForFootTitle release];
    [_imageViewForFlash release];
    [_labelForTitle release];
    [_view release];
    [super dealloc];

}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.contentView.dk_backgroundColorPicker = DKColorWithColors([UIColor linenColor], [UIColor grayColor]);        
        [self createSubview];
        
    }
    
    return self;
}

- (void)createSubview {
    
    self.view = [[UIView alloc] init];
    [self.contentView addSubview:self.view];
    [_view release];
    
    self.labelForFootTitle = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelForFootTitle];
    [_labelForFootTitle release];
    
    self.labelForTitle = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelForTitle];
    [_labelForTitle release];
    
    self.imageViewForFlash = [[UIImageView alloc] init];
    [self.contentView addSubview:self.imageViewForFlash];
    [_imageViewForFlash release];
    
    
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    self.view.frame = CGRectMake(2, 5, self.contentView.frame.size.width - 4, self.contentView.frame.size.height - 10);
    //self.view.backgroundColor = [UIColor whiteColor];
    self.view.dk_backgroundColorPicker = DKColorWithRGB (0xffffff, 0x343434);
    
    self.imageViewForFlash.frame = CGRectMake(2 * WEIGHTT, 5 * HEIGHTT, self.contentView.frame.size.width / 4, self.contentView.frame.size.height - 10 * HEIGHTT);
    //self.imageViewForFlash.backgroundColor = [UIColor yellowColor];
    
    self.labelForTitle.frame = CGRectMake(10 * WEIGHTT + self.contentView.frame.size.width / 4, 30 * HEIGHTT, self.contentView.frame.size.width - self.contentView.frame.size.width / 4 - 20 * WEIGHTT, self.contentView.frame.size.height / 2);
    self.labelForTitle.dk_textColorPicker = DKColorWithColors([UIColor blackColor], [UIColor whiteColor]);
   // self.labelForTitle.backgroundColor = [UIColor redColor];
    self.labelForTitle.numberOfLines = 0;
    
    self.labelForFootTitle.frame = CGRectMake(self.contentView.frame.size.width / 6 * 5, self.contentView.frame.size.height / 6 * 4, self.contentView.frame.size.width / 8, self.contentView.frame.size.width / 18);
    self.labelForFootTitle.font = [UIFont systemFontOfSize:14];
    //self.labelForFootTitle.backgroundColor = [UIColor greenColor];
    self.labelForFootTitle.textColor = [UIColor greenColor];
    self.labelForFootTitle.text = @"视频集";
    
}

-(void)passModelForNBA:(ModelForNBA *)model {

    self.labelForTitle.text = model.title;

 [self.imageViewForFlash sd_setImageWithURL:[NSURL URLWithString:model.image]];



}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
